<?php
	header('content-type:text/html;charset="utf-8"');
	
	require_once "conn.php";
	require_once "je.php";
	$conn=new mysqli($hn,$un,$pw,$db);
	
	if($conn->connect_error) die($conn->connect_error);
	
	$json=file_get_contents("php://input");
	$data = json_decode($json,true);
	//$tb=$_REQUEST["list-data"];
	$tb=$data['list-data'];
	
	
	if($tb=="article"){
		$query="select * from article";
	}
	if($tb=="images"){
		$query="select * from images";
	}
	if($tb=="movies"){
		$query="select * from movies";
	}
	if($tb=="gly"){
		$query="select * from users";
	}
	$conn->query('set names utf8');
	$result=$conn->query($query);

	if(!$result) die($conn->error);
	$results=array();
	$results["data"]=array();
	if($conn->affected_rows<1){
		$results["code"]=0;
		$results["mes"]="没有数据";
	}
	else{
		$results["code"]=1;
		while($row=$result->fetch_array(MYSQLI_ASSOC)){
			$results["data"][]=$row;
		}
	}
	$s=my_json_encode($results);
	echo $s;
	$result->close();
	$conn->close();
?>